package com.rcadmin.busi.example.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.rcadmin.busi.example.dao.UserDao;
import com.rcadmin.busi.example.ddl.User;
import com.rcadmin.core.jpa.util.PageBean;

@Component
public class UserService {
	@Resource
	private UserDao userDao;

	@Transactional
	public void save(User user) {
		userDao.save(user);
	} 

	public List<User> findByName(String name) {
		List<User> list = userDao.findByName(name);
		return list;
	}
	@Transactional
	public void update(User user) {
		userDao.update(user);
	}
	@Transactional
	public void delete(User user) {
		userDao.delete(user);
	}

	public User findOne(Integer id) {
		return userDao.findOne(id);
	}

	public PageBean<User> pageQuery(String condition, String orderBy,
			Integer pageSize, Integer page) {
		return userDao.pageQuery(condition, orderBy, pageSize, page);
	}

}
